import { defineStore } from "pinia";
import { RootState } from "../interface";

export const useUserStore = defineStore("user", {
	state: (): RootState => ({
		userInfo: {
			userId: "",
			userName: "userInfo"
		},
		token: ""
	}),
	getters: {},
	actions: {
		async setUserInfo() {
			// 这里可以发起请求
			// const userInfo = await getUserInfo();
			this.userInfo.userName = "userInfo";
		},
		setName(name: string) {
			this.userInfo.userName = name;
		}
	}
});
